home *** CD-ROM | disk | FTP | other *** search
- property spr, mem
- property y_max, y_min, x_max, x_min
- property espera -- Tempo de espera entre cada mudanca (em ticks)
- property ultimaTroca
-
- on getBehaviorDescription
- return "Anima sprites"
- end
-
- on getPropertyDescriptionList
- set p_list = [ ¬
- #x_min: [ #comment: "X minimo", ¬
- #format: #integer, ¬
- #default: 0 ], ¬
- #y_min: [ #comment: "Y minimo ", ¬
- #format: #integer, ¬
- #default: 0 ], ¬
- #x_max: [ #comment: "X maximo", ¬
- #format: #integer, ¬
- #default: 639 ], ¬
- #y_max: [ #comment: "Y maximo ", ¬
- #format: #integer, ¬
- #default: 479 ], ¬
- #espera: [ #comment: "Espera entre cada troca em 1/60s (velocidade)",¬
- #format: #integer,¬
- #default: 180 ]¬
- ]
- return p_list
- end
-
- on beginSprite me
- set spr = the spriteNum of me
- set mem = the member of sprite spr
-
- set w = the width of sprite spr
- set h = the height of sprite spr
- set x = the locH of the regPoint of member mem
- set y = the locV of the regPoint of member mem
- set x_min = x_min + x
- set y_min = y_min + y
- set x_max = x_max - (w - x)
- set y_max = y_max - (h - y)
-
- puppetSprite spr, true
- posiciona me
- end
-
- on cleanSprite me
- puppetSprite spr, false
- end
-
- on posiciona me
- set x = random(x_max - x_min + 1) - 1 + x_min
- set y = random(y_max - y_min + 1) - 1 + y_min
- set the locH of sprite spr to x
- set the locV of sprite spr to y
- set ultimaTroca = the timer
- end
-
- on idleSprite me
- global gMustUpdate
-
- -- Testa se ja e' hora de trocar figura
- if (the timer - ultimaTroca) > espera then
- posiciona me
- set gMustUpdate = true
- end if
- end